using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ItemObject : MonoBehaviour
{
    [SerializeField] private Rigidbody2D rb;
    [SerializeField] private ItemData_Weapon itemData;
    [SerializeField] Vector2 velocity;

    private void SetUpVisuals()
    {
        if (itemData == null)
            return;

        GetComponent<SpriteRenderer>().sprite = itemData.icon;
        gameObject.name = "ItemObject-" + itemData.type.ToString() + "-" + itemData.name;
    }

    public void PickUpItem()
    {
        if(!Inventory.instance.CanAddItem())
        {
            rb.velocity = new Vector2(0, 7);
            return;
        }

        Inventory.instance.AddItem(itemData);
    }
}
